package com.example.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * <b><code>ProjectNameConfig</code></b>
 * <p>
 * Description
 * <p>
 * <b>Create Time:</b> 2023/2/17 16:11.
 *
 * @author qd.yt
 * @version 0.0.1
 * @since demo-openfeign v0.0.1
 */
@Configuration
public class ProjectNameConfig implements EnvironmentAware {
    @Value("${spring.application.name}")
    private String applicationName;
    @Override
    public void setEnvironment(Environment environment) {
        String appName = System.getProperty("project.name");
        if (appName==null||"".equalsIgnoreCase(appName)) {
            System.setProperty("project.name",applicationName);
        }

    }
}